﻿using System.Web.Caching;

namespace System.Data
{
    // Token: 0x02000005 RID: 5
    internal abstract class BaseCache : ICache
	{
		// Token: 0x17000005 RID: 5
		// (get) Token: 0x06000019 RID: 25 RVA: 0x00002314 File Offset: 0x00000514
		// (set) Token: 0x0600001A RID: 26 RVA: 0x0000232C File Offset: 0x0000052C
		public int ExpirationSenconds
		{
			get
			{
				return this._time;
			}
			set
			{
				this._time = value;
			}
		}

		// Token: 0x17000006 RID: 6
		// (get) Token: 0x0600001B RID: 27 RVA: 0x00002338 File Offset: 0x00000538
		// (set) Token: 0x0600001C RID: 28 RVA: 0x00002353 File Offset: 0x00000553
		public int ExpirationMinutes
		{
			get
			{
				return this._time / 60;
			}
			set
			{
				this._time = value * 60;
			}
		}

		// Token: 0x17000007 RID: 7
		// (get) Token: 0x0600001D RID: 29 RVA: 0x00002360 File Offset: 0x00000560
		// (set) Token: 0x0600001E RID: 30 RVA: 0x0000237E File Offset: 0x0000057E
		public int ExpirationHours
		{
			get
			{
				return this._time / 60 / 60;
			}
			set
			{
				this._time = value * 60 * 60;
			}
		}

		// Token: 0x17000008 RID: 8
		// (get) Token: 0x0600001F RID: 31 RVA: 0x00002390 File Offset: 0x00000590
		// (set) Token: 0x06000020 RID: 32 RVA: 0x000023A8 File Offset: 0x000005A8
		public string DependencyFilePath
		{
			get
			{
				return this._dependencyFilePath;
			}
			set
			{
				this._dependencyFilePath = value;
			}
		}

		// Token: 0x06000021 RID: 33 RVA: 0x000023B2 File Offset: 0x000005B2
		public BaseCache()
		{
			this._time = 3600;
			this._dependencyFilePath = null;
		}

		// Token: 0x06000022 RID: 34 RVA: 0x000023D0 File Offset: 0x000005D0
		public bool Contains(string key)
		{
			bool result;
			if (string.IsNullOrEmpty(key))
			{
				result = false;
			}
			else
			{
				key = key.Trim().ToLower();
				result = this.ContainsKey(key);
			}
			return result;
		}

		// Token: 0x06000023 RID: 35
		public abstract bool ContainsKey(string key);

		// Token: 0x06000024 RID: 36 RVA: 0x00002408 File Offset: 0x00000608
		public void Add(string key, object target, int time)
		{
			if (!string.IsNullOrEmpty(key) && target != null)
			{
				key = key.Trim().ToLower();
				if (string.IsNullOrEmpty(this._dependencyFilePath))
				{
					this.AddCache(key, target, time, null);
				}
				else
				{
					CacheDependency dependency = new CacheDependency(this._dependencyFilePath);
					this.AddCache(key, target, time, dependency);
				}
			}
		}

		// Token: 0x06000025 RID: 37
		protected abstract void AddCache(string key, object target, int time, CacheDependency dependency);

		// Token: 0x06000026 RID: 38 RVA: 0x00002478 File Offset: 0x00000678
		public T Get<T>(string key) where T : class
		{
			T result;
			if (string.IsNullOrEmpty(key))
			{
				result = default(T);
			}
			else
			{
				key = key.Trim().ToLower();
				result = this.GetCache<T>(key);
			}
			return result;
		}

		// Token: 0x06000027 RID: 39
		protected abstract T GetCache<T>(string key) where T : class;

		// Token: 0x06000028 RID: 40 RVA: 0x000024B8 File Offset: 0x000006B8
		public void Remove(string key)
		{
			if (!string.IsNullOrEmpty(key))
			{
				key = key.Trim().ToLower();
				this.RemoveCache(key);
			}
		}

		// Token: 0x06000029 RID: 41
		protected abstract void RemoveCache(string key);

		// Token: 0x0600002A RID: 42
		public abstract void ClearAll();

		// Token: 0x0400000D RID: 13
		private int _time;

		// Token: 0x0400000E RID: 14
		private string _dependencyFilePath;
	}
}
